<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/11
 * Time: 10:48
 */
namespace app\api\controller;
use think\Db;
use think\Request;
use app\api\model\Collect as collectModel;
class Collect extends Common
{
    /*
     * 我的收藏
     */
    public function collect()
    {
        if(Request::instance()->isPost()){
            $type = input('type','1','trim');
            $post = Request::instance()->post();
            $page = $this->p();
            $collect = new collectModel();
            if($type==1){
                $data = $collect->collects($post['uid'],$type,$page);
            }
            if($type==2){
                $data = $collect->collects($post['uid'],$type,$page,$post['latitude'],$post['longitude']);
            }
            if($type==3){
                $data = $collect->collects($post['uid'],$type,$page);
            }
            if($type==4){
                $data = $collect->collects($post['uid'],$type,$page,$post['latitude'],$post['longitude']);
            }
            if($type==5){
                $data = $collect->collects($post['uid'],$type,$page);
            }
            if($type==6){
                $data = $collect->collects($post['uid'],$type,$page);
            }
            $this->apiReturn('200','成功',$data);
        }
    }

    /**
     * [addCollection 添加收藏]
     * @Author   kendy
     * @DateTime 2019-11-14T13:59:32+0800
     */
    public function addCollection()
    {
      //先验证传过来的类型和id是否有效
            //code.....
      //如果有效则添加收藏 
     if(Request::instance()->isPost()){
        $collect = new collectModel();
        $collect->addCollection();
      } 

    }


  /**
   * [cancelCollection 取消收藏]
   * @Author   kendy  
   * @DateTime 2019-12-11T15:51:59+0800
   * @return   [type]                   [description]
   */
    public function cancelCollection()
    { 
      if(Request::instance()->isPost()){
        $collect = new collectModel();
        $collect->cancelCollection();
      } 
    }

}